use "EJPR_nato_replication_data.dta", clear

gen defend_nato_recode = defend_nato_bin*100

* Main effects -- Figure 1 *
gen fig1effect = .
gen fig1lower = .
gen fig1upper = .

svy:reg defend_nato_recode article5
mat A = r(table)
replace fig1effect = A[1,1] if count == 1
replace fig1lower = A[5,1] if count == 1
replace fig1upper = A[6,1] if count == 1

svy:reg defend_nato_recode article5
margins, by(article5)
mat A = r(table)
replace fig1effect = A[1,1] if count == 2
replace fig1lower = A[5,1] if count == 2
replace fig1upper = A[6,1] if count == 2
replace fig1effect = A[1,2] if count == 3
replace fig1lower = A[5,2] if count == 3
replace fig1upper = A[6,2] if count == 3

twoway (scatter  count fig1effect if count <4) (rcap fig1lower fig1upper count if count<4, horizontal color(black)), ///
 ylabel(1 "Difference" 2 "Control" 3 "Article 5 Treatment", angle(360)) yscale(range(.5 3.5)) legend(off) yti("") ///
 xti(" " "% Support for sending troops") graphregion(color(white)) xline(0)

* Gender as a Moderator -- Figure 2 *
use "EJPR_nato_replication_data.dta", clear
gen defend_nato_recode = defend_nato_bin*100
gen fig3effect = .
gen fig3lower = .
gen fig3upper = .

svy:reg defend_nato_recode article5 if female == 0
mat A = r(table)
replace fig3effect = A[1,1] if count == 1
replace fig3lower = A[5,1] if count == 1
replace fig3upper = A[6,1] if count == 1

svy:reg defend_nato_recode article5 if female == 0
margins, by(article5)
mat A = r(table)
replace fig3effect = A[1,1] if count == 2
replace fig3lower = A[5,1] if count == 2
replace fig3upper = A[6,1] if count == 2
replace fig3effect = A[1,2] if count == 3
replace fig3lower = A[5,2] if count == 3
replace fig3upper = A[6,2] if count == 3

svy:reg defend_nato_recode article5 if female == 1
mat A = r(table)
replace fig3effect = A[1,1] if count == 5
replace fig3lower = A[5,1] if count == 5
replace fig3upper = A[6,1] if count == 5

svy:reg defend_nato_recode article5 if female == 1
margins, by(article5)
mat A = r(table)
replace fig3effect = A[1,1] if count == 6
replace fig3lower = A[5,1] if count == 6
replace fig3upper = A[6,1] if count == 6
replace fig3effect = A[1,2] if count == 7
replace fig3lower = A[5,2] if count == 7
replace fig3upper = A[6,2] if count == 7

twoway (scatter  count fig3effect if count <8) (rcap fig3lower fig3upper count if count<8, horizontal color(black)), ///
 ylabel(4 "{bf:Men}" 1 "Difference" 2 "Control" 3 "Article 5 Treatment" 5 "Difference" 6 "Control" 7 "Article 5 Treatment" 8 "{bf:Women}", angle(360)) yscale(range(.5 8.5)) legend(off) yti("") ///
 xti(" " "% Support for sending troops") graphregion(color(white)) xline(0) xlabel(0 20 40 60)

* Partisan Moderation -- Figure 3 *
use "EJPR_nato_replication_data.dta", clear
gen defend_nato_recode = defend_nato_bin*100
gen fig3effect = .
gen fig3lower = .
gen fig3upper = .

gen left = 0
replace left = 1 if pref_PD == 1
replace left = 1 if pref_Azione == 1
replace left = 1 if pref_IV == 1
replace left = 1 if pref_M5S == 1
replace left = 1 if pref_Sinsitra == 1

gen right = 0
replace right = 1 if pref_Lega == 1
replace right = 1 if pref_FDI == 1
replace right = 1 if pref_FI == 1

svy:reg defend_nato_recode article5 if right == 1
mat A = r(table)
replace fig3effect = A[1,1] if count == 1
replace fig3lower = A[5,1] if count == 1
replace fig3upper = A[6,1] if count == 1

svy:reg defend_nato_recode article5 if right == 1
margins, by(article5)
mat A = r(table)
replace fig3effect = A[1,1] if count == 2
replace fig3lower = A[5,1] if count == 2
replace fig3upper = A[6,1] if count == 2
replace fig3effect = A[1,2] if count == 3
replace fig3lower = A[5,2] if count == 3
replace fig3upper = A[6,2] if count == 3

svy:reg defend_nato_recode article5 if left == 1
mat A = r(table)
replace fig3effect = A[1,1] if count == 5
replace fig3lower = A[5,1] if count == 5
replace fig3upper = A[6,1] if count == 5

svy:reg defend_nato_recode article5 if left == 1
margins, by(article5)
mat A = r(table)
replace fig3effect = A[1,1] if count == 6
replace fig3lower = A[5,1] if count == 6
replace fig3upper = A[6,1] if count == 6
replace fig3effect = A[1,2] if count == 7
replace fig3lower = A[5,2] if count == 7
replace fig3upper = A[6,2] if count == 7

twoway (scatter  count fig3effect if count <8) (rcap fig3lower fig3upper count if count<8, horizontal color(black)), ///
 ylabel(4 "{bf:Right-leaning partisans}" 1 "Difference" 2 "Control" 3 "Article 5 Treatment" 5 "Difference" 6 "Control" 7 "Article 5 Treatment" 8 "{bf:Left-leaning partisans}", angle(360)) yscale(range(.5 8.5)) legend(off) yti("") ///
 xti(" " "% Support for sending troops") graphregion(color(white)) xline(0)

svy:reg defend_nato_recode i.article5##i.left if left == 1|right==1

 
* SUPPORTING INFORMATION *
use "EJPR_nato_replication_data.dta", clear

* SI Table 2: Balance tests *
gen left = 0
replace left = 1 if pref_PD == 1
replace left = 1 if pref_Azione == 1
replace left = 1 if pref_IV == 1
replace left = 1 if pref_Sinsitra == 1

gen right = 0
replace right = 1 if pref_Lega == 1
replace right = 1 if pref_FDI == 1
replace right = 1 if pref_FI == 1

gen party4 = 4
replace party4 = 1 if left == 1
replace party4 = 2 if pref_M5S == 1
replace party4 = 3 if right == 1
* Recode the new party measure missing if respondent refused to answer the vote choice question *
replace party4 = . if pref_M5S == .
label define parties 1 "Left" 2 "M5S" 3 "Right" 4 "Other/No party" , replace
label values party4 parties

gen party3 = 3
replace party3 = 1 if left == 1
replace party3 = 1 if pref_M5S == 1
replace party3 = 2 if right == 1
* Recode the new party measure missing if respondent refused to answer the vote choice question *
replace party3 = . if pref_M5S == .
label define parties2 1 "Left" 2 "Right" 3 "Other/No party" , replace
label values party3 parties2

 oneway left article5, tab
 oneway right article5, tab
 oneway female article5, tab
 oneway age article5, tab
 gen baplus = 0
 replace baplus = 1 if education == 7
 replace baplus = 1 if education == 8
 replace baplus = 1 if education == 9
 replace baplus = 1 if education == 10
 replace baplus = 1 if education == 11
 replace baplus = 1 if education == 12
 oneway baplus article5, tab

* SI Table 3: Main effects logit model with controls *
svy:logit defend_nato_bin article5 pref_Lega pref_FI pref_FDI pref_M5S pref_PD pref_Azione mip_ukraine polint female education ages2 ages3 ages4 ages5
outreg2 using sitable3, word label dec(2)  2aster replace

* SI Table 4: Multinomial logit *
svy:mlogit defend_nato3 article5 pref_Lega pref_FI pref_FDI pref_M5S pref_PD pref_Azione mip_ukraine polint female education ages2 ages3 ages4 ages5, base(3)
outreg2 using sitable4, word label dec(2)  2aster replace

* SI Table 5: Gender Interaction *
svy:logit defend_nato_bin article5##i.female pref_Azione  pref_PD pref_FDI pref_FI pref_Lega pref_M5S  mip_ukraine polint  education ages2 ages3 ages4 ages5
outreg2 using sitable5, word label dec(2)  2aster replace

* SI Table 6: Partisan Interactions *
svy:logit defend_nato_bin article5##i.party3
outreg2 using sitable6, word label dec(2)  2aster replace  
svy:logit defend_nato_bin article5##i.party3 mip_ukraine polint female education ages2 ages3 ages4 ages5 
outreg2 using sitable6, word label dec(2)  2aster append
svy:logit defend_nato_bin article5##i.party4 
outreg2 using sitable6, word label dec(2)  2aster append
svy:logit defend_nato_bin article5##i.party4 mip_ukraine polint female education ages2 ages3 ages4 ages5 
outreg2 using sitable6, word label dec(2)  2aster append

* SI Figure 1: Marginal effects from logit in SI Table 3 *
svy:logit defend_nato_bin ages5 ages4 ages3 ages2 education female  polint  mip_ukraine pref_Azione  pref_PD pref_FDI pref_FI pref_Lega pref_M5S article5
margins, dydx (article5  pref_M5S pref_Lega pref_FI pref_FDI pref_PD  pref_Azione mip_ukraine polint  female education ages2 ages3 ages4 ages5)  at(article5=0  pref_M5S=0 pref_Lega=0 pref_FI=0 pref_FDI=0 pref_PD=0 pref_Azione=0 polint mip_ukraine=0  female=0 education=4 ages2=0 ages3=0 ages4=0 ages5=0)
marginsplot, horizontal recast(scatter) recastci(rspike) xline(0)  xlabel(-.4 -.3 -.2 -.1 0 .1 .2 .3) ///
yti("") xti(" " "Change in prob. of support") graphregion(color(white))   ///
ylabel(1 "Age: 55+" 2 "Age:45-54" 3 "Age: 35-44" 4 "Age: 25-34" 5 "Education" 6 "Female" 7 "Interest in politics" 8 "MIP: Ukraine" 9 "Azione/+Europa" 10 "Partito Democratico" 11 "Fratelli d'Italia" 12 "Forza Italia" 13 "Lega" 14 "Movimento 5 Stelle" 15 "Treaty obligation treatment" ) ti("") scale(.9) 

* SI Figure 2: 
tab defend_nato3, gen(defends)

graph bar defends1 defends2 defends3 [pw=weight], over(article5, relabel(1 "Control" 2 "Article 5 treatment")) graphregion(color(white)) yti("Percent") ///
bargap(5) ylabel(0 "0%" .1 "10%" .2 "20%" .3 "30%" .4 "40%" .5 "50%") yti("") ///
bar(1, color(gs0) lcolor(black)) bar(2, color(gs6) lcolor(black)) bar(3, color(gs14) lcolor(black)) ///
legend(order(1 "Yes, send troops" 2 "No, do not send troops" 3 "Unsure")rows(1)symxsize(5))  saving(sifig2top.gph, replace)

svy:mlogit defend_nato3 article5 pref_Lega pref_FI pref_FDI pref_M5S pref_PD pref_Azione mip_ukraine polint female education ages2 ages3 ages4 ages5, base(3)
margins, dydx (article5) at( pref_M5S=0 pref_Lega=0 pref_FI=0 pref_FDI=0 pref_PD=0 pref_Azione=0 polint mip_ukraine=0  female=0 education=4 ages2=0 ages3=0 ages4=0 ages5=0)
marginsplot, horizontal recast(scatter) recastci(rspike) xline(0) ysc(reverse) ti("") graphregion(color(white)) yti("") xti(" " "Estimated effect of Article 5 treatment on probability") ylabel(1 "Send troops" 2 "Do not send troops" 3 "Unsure") yscale(range(.75 3.25)) saving(sifig2bottom.gph, replace)

graph combine "sifig2top.gph" "sifig2bottom.gph", rows(2) graphregion(color(white)) xsize(8.5) ysize(11) 

* SI Figure 3 *
svy:logit defend_nato_bin article5##i.female pref_Azione  pref_PD pref_FDI pref_FI pref_Lega pref_M5S  mip_ukraine polint  education ages2 ages3 ages4 ages5
margins, at(female=(0(1)1) article5=(0(1)1)) vsquish atmeans
marginsplot, x(article5) plot2opts(lpattern(--)) xscale(range(-.1 1.1)) legend(size(small)) ti("") yti("Support for sending troops" " ") graphregion(color(white)) xlabel(0 "Control" 1 "Article 5") xti("") legend(order(3 "Male" 4 "Female")) ylabel(.2 .3 .4 .5 .6) saving("logit_gender.gph", replace) plot1opts(symbol(square))

* SI Figure 4 *
use "EJPR_nato_replication_data.dta", clear
gen defend_nato_recode = defend_nato_bin*100
gen fig3effect = .
gen fig3lower = .
gen fig3upper = .

gen left = 0
replace left = 1 if pref_PD == 1
replace left = 1 if pref_Azione == 1
replace left = 1 if pref_IV == 1
replace left = 1 if pref_Sinsitra == 1

gen right = 0
replace right = 1 if pref_Lega == 1
replace right = 1 if pref_FDI == 1
replace right = 1 if pref_FI == 1

gen M5S = 0
replace M5S = 1 if pref_M5S == 1

gen other = 0
replace other = 1 if pref_other == 1

svy:reg defend_nato_recode article5 if right == 1
mat A = r(table)
replace fig3effect = A[1,1] if count == 1
replace fig3lower = A[5,1] if count == 1
replace fig3upper = A[6,1] if count == 1

svy:reg defend_nato_recode article5 if right == 1
margins, by(article5)
mat A = r(table)
replace fig3effect = A[1,1] if count == 2
replace fig3lower = A[5,1] if count == 2
replace fig3upper = A[6,1] if count == 2
replace fig3effect = A[1,2] if count == 3
replace fig3lower = A[5,2] if count == 3
replace fig3upper = A[6,2] if count == 3

svy:reg defend_nato_recode article5 if left == 1
mat A = r(table)
replace fig3effect = A[1,1] if count == 5
replace fig3lower = A[5,1] if count == 5
replace fig3upper = A[6,1] if count == 5

svy:reg defend_nato_recode article5 if left == 1
margins, by(article5)
mat A = r(table)
replace fig3effect = A[1,1] if count == 6
replace fig3lower = A[5,1] if count == 6
replace fig3upper = A[6,1] if count == 6
replace fig3effect = A[1,2] if count == 7
replace fig3lower = A[5,2] if count == 7
replace fig3upper = A[6,2] if count == 7

svy:reg defend_nato_recode article5 if M5S == 1
mat A = r(table)
replace fig3effect = A[1,1] if count == 9
replace fig3lower = A[5,1] if count == 9
replace fig3upper = A[6,1] if count == 9

svy:reg defend_nato_recode article5 if M5S == 1
margins, by(article5)
mat A = r(table)
replace fig3effect = A[1,1] if count == 10
replace fig3lower = A[5,1] if count == 10
replace fig3upper = A[6,1] if count == 10
replace fig3effect = A[1,2] if count == 11
replace fig3lower = A[5,2] if count == 11
replace fig3upper = A[6,2] if count == 11

svy:reg defend_nato_recode article5 if other == 1
mat A = r(table)
replace fig3effect = A[1,1] if count == 13
replace fig3lower = A[5,1] if count == 13
replace fig3upper = A[6,1] if count == 13

svy:reg defend_nato_recode article5 if other == 1
margins, by(article5)
mat A = r(table)
replace fig3effect = A[1,1] if count == 14
replace fig3lower = A[5,1] if count == 14
replace fig3upper = A[6,1] if count == 14
replace fig3effect = A[1,2] if count == 15
replace fig3lower = A[5,2] if count == 15
replace fig3upper = A[6,2] if count == 15

twoway (scatter  count fig3effect if count <16) (rcap fig3lower fig3upper count if count<16, horizontal color(black)), ///
 ylabel(4 "{bf:Right-leaning parties}" 1 "Difference" 2 "Control" 3 "Article 5 Treatment" 5 "Difference" 6 "Control" 7 "Article 5 Treatment" 8 "{bf:Left-leaning parties}" 9 "Difference" 10 "Control" 11 "Article 5 Treatment" 12 "{bf:Movimento Cinque Stelle}" 13 "Difference" 14 "Control" 15 "Article 5 Treatment" 16 "{bf:Other/no party preference}", angle(360)) yscale(range(.5 8.5)) legend(off) yti("") ///
 xti(" " "% Support for sending troops") graphregion(color(white)) xline(0)

* SI Figure 5: Partisan moderation with all blocs *
use "EJPR_nato_replication_data.dta", clear

gen left = 0
replace left = 1 if pref_PD == 1
replace left = 1 if pref_Azione == 1
replace left = 1 if pref_IV == 1
replace left = 1 if pref_Sinsitra == 1

gen right = 0
replace right = 1 if pref_Lega == 1
replace right = 1 if pref_FDI == 1
replace right = 1 if pref_FI == 1

gen party4 = 4
replace party4 = 1 if left == 1
replace party4 = 2 if pref_M5S == 1
replace party4 = 3 if right == 1
* Recode the new party measure missing if respondent refused to answer the vote choice question *
replace party4 = . if pref_M5S == .
label define parties 1 "Left" 2 "M5S" 3 "Right" 4 "Other/No party" , replace
label values party4 parties

gen party3 = 3
replace party3 = 1 if left == 1
replace party3 = 1 if pref_M5S == 1
replace party3 = 2 if right == 1
* Recode the new party measure missing if respondent refused to answer the vote choice question *
replace party3 = . if pref_M5S == .
label define parties2 1 "Left" 2 "Right" 3 "Other/No party" , replace
label values party3 parties2

svy:logit defend_nato_bin article5##i.party4 mip_ukraine polint female education ages2 ages3 ages4 ages5 
margins party4, dydx(article5) post coeflegend
test _b[1.article5:1bn.party4]=_b[1.article5:3.party4]
marginsplot, recast(scatter) horizontal graphregion(color(white)) ti("") xti(" " "Estimated effect of Article 5 treatment on pr(support)") ysc(reverse) xline(0) yti("") saving(party4.gph, replace)

svy:logit defend_nato_bin article5##i.party3 mip_ukraine polint female education ages2 ages3 ages4 ages5 
margins party3, dydx(article5) post coeflegend
test _b[1.article5:1bn.party3]=_b[1.article5:2.party3]
marginsplot, recast(scatter) horizontal graphregion(color(white)) ti("") xti(" " "Estimated effect of Article 5 treatment on pr(support)") ysc(reverse) xline(0) yti("") saving(party3.gph, replace)

graph combine "party3.gph" "party4.gph", rows(2) graphregion(color(white)) xsize(8.5) ysize(11) 







